<?php
/**
 * Created by 张彪.
 * User: 小马出行
 * Date: 2018/4/18
 * Time: 11:34
 */
namespace app\admin\inter_model;
use think\Model;
use think\Db;

class RefundScaleModel extends Model
{
    public function addScale($data)
    {
        return Db::table('inter_refund_fee_scale')->insertGetId($data);
    }

    public function updateScale($map,$data)
    {
        return Db::table('inter_refund_fee_scale')->where($map)->update($data);
    }

    public function getScaleList($map,$field='a.*',$page=1,$limit=10)
    {
        return Db::connect(config('intercity_db'))->name('refund_fee_scale a')->join('arean b','a.start_city=b.id','LEFT')
            ->where($map)->field($field)->page($page,$limit)->order('a.id desc')->select();
    }

    public function searchScale($map,$field='*')
    {
        return Db::table('inter_refund_fee_scale')->where($map)->field($field)->find();
    }
}